import { isPlayerExist, storagePlayerData, getPlayerList } from '../l.js'
export class Fs extends plugin {
    constructor() {
        super({
            name: '[Fs]开始游戏',
            dsc: '开始游戏',
            event: 'message',
            priority: 1,
            rule: [
                { reg: /^(#|\/)?领取田地$/, fnc: 'collectingLand' }
            ]
        })
    }
    async collectingLand(e) {
        const PLAYER_ID = e.user_id
        if (isPlayerExist(PLAYER_ID)) {
            return e.reply('不可重复领取哦喵~')
        }
        storagePlayerData(PLAYER_ID, {
            name: '农场主',
            capital: 0,
            xp: 0,
            frame: [
                {
                    start: false,
                    name: "无",
                    time: "无"
                }
            ],
            Stash: {},
        })

        logger.mark(logger.green(`种田模拟器第${(getPlayerList()).length}位用户`))

        const msg = [
            '哦嚯嚯~',
            '欢迎游玩种田模拟器',
            '发送[种田帮助]查看所有功能'
        ].join('\r')
        return e.reply([
            segment.at(PLAYER_ID),
            msg
        ])
    }
}